package com.sanxiau.dormitory.yang;
//父类
public class Father {
    //父类属性
    //姓名
    public String name;
    //年龄
    private int age;
    //工资
    private double wage;
    //父类的无参构造
    public Father() {
        System.out.println("父类的无参构造");
        name = "父亲";
    }
    //父类的有参构造
    public Father(String name, int age, double wage) {
        this.name = name;
        this.age = age;
        this.wage = wage;
        System.out.println("父类的有参构造");
    }
    //get，set方法
    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }

    public double getWage() {
        return wage;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void setWage(double wage) {
        this.wage = wage;
    }

    public static void work(){
        System.out.println("父亲上班");
    }
    public void eat(){
        System.out.println("吃饭");
    }
    public void eat(String p){
        System.out.println("父亲和"+p+"吃饭");
    }

}
